package com.gdut.demo.dao;

import com.gdut.demo.entity.Ecg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EcgDao {

    //根据id获取一个值
    @Select("select id,voltage from ecg where id = #{id}")
    Ecg getOne(Integer id);

    //获取所有ecg数据
    @Select("select id, voltage from ecg")
    List<Ecg> getAll();

    //获取所有ecg数据
    @Select("select id, voltage from ecg_8hours")
    List<Ecg> getAllFromEcg8Hours();

    /*
     * 获取一页的数据类
     * limit有两个参数，第一个参数表示从第几行数据开始查，第二个参数表示查几条数据，“limit 3,2”表示从第四行数据开始，取两条数据。
     * */
    @Select("select id, voltage from ecg_8hours limit #{page},500")
    List<Ecg> getOnePageDate(@Param("page") Integer page);

    @Select("select id, voltage from f where id between 1 and 20000")
    List<Ecg> getFWave();

    @Select("select id, voltage from mix where id between 1 and 20000")
    List<Ecg> getMix();

    @Select("select id, voltage from ecg_8hours where id between 1 and 20000")
    List<Ecg> getEcg();


}
